<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<jsp:include page="/admin/header.jsp"></jsp:include>
<div class="main">
	<div class="body container">
		<div class="typecho-page-title">
			<h2>管理标签</h2>
		</div>
		<div class="row typecho-page-main manage-metas">

			<div class="col-mb-12 col-tb-8" role="main">

				<form method="post" name="manage_tags" class="operate-form">
					<div class="typecho-list-operate clearfix">
						<div class="operate">
							<label><i class="sr-only">全选</i><input type="checkbox"
								class="typecho-table-select-all"></label>
							<div class="btn-group btn-drop">
								<button class="btn dropdown-toggle btn-s" type="button">
									<i class="sr-only">操作</i>选中项 <i class="i-caret-down"></i>
								</button>
								<ul class="dropdown-menu">
									<li><a lang="你确认要删除这些标签吗?"
										href="${options.siteUrl}/action/admin?do=deleteTag">删除</a></li>
									<%-- <li><a lang="刷新标签可能需要等待较长时间, 你确认要刷新这些标签吗?"
										href="${options.siteUrl}/index.php/action/metas-tag-edit?do=refresh&amp;_=915f91687649d44fbe178398fc1b0939">刷新</a></li>
									<li class="multiline">
										<button type="button" class="btn btn-s merge"
											rel="${options.siteUrl}/index.php/action/metas-tag-edit?do=merge&amp;_=915f91687649d44fbe178398fc1b0939">合并到</button>
										<input type="text" name="merge" class="text-s">
									</li> --%>
								</ul>
							</div>
						</div>
					</div>

					<ul class="typecho-list-notable tag-list clearfix">
						<c:forEach var="tag" items="${tags}">
							<li class="size-5" id="tag-${tag['mid']}"><input
								type="checkbox" value="${tag['mid']}" name="mid[]"><span
								rel="${options.siteUrl}/admin/manage-tags?mid=${tag['mid']}">${tag['name']}</span>
								<a class="tag-edit-link"
								href="${options.siteUrl}/admin/manage-tags?mid=${tag['mid']}"><i
									class="i-edit"></i></a></li>
						</c:forEach>
					</ul>
					<input type="hidden" name="do" value="delete">
				</form>

			</div>
			<div class="col-mb-12 col-tb-4" role="form">
				<form action="${options.siteUrl}/action/admin?do=tagEdit"
					method="post" enctype="application/x-www-form-urlencoded">
					<ul class="typecho-option" id="typecho-option-item-name-0">
						<li><label class="typecho-label" for="name-0-1"> 标签名称
								*</label> <input id="name-0-1" name="tag.name" type="text" class="text"
							value="${tag['name'] }">
							<p class="description">这是标签在站点中显示的名称.可以使用中文,如 "地球".</p></li>
					</ul>
					<ul class="typecho-option" id="typecho-option-item-slug-1">
						<li><label class="typecho-label" for="slug-0-2">
								标签缩略名</label> <input id="slug-0-2" name="tag.slug" type="text"
							class="text" value="${tag['slug'] }">
							<p class="description">标签缩略名用于创建友好的链接形式, 如果留空则默认使用标签名称.</p></li>
					</ul>
					<ul class="typecho-option" id="typecho-option-item-mid-3"
						style="display: none">
						<li><input name="tag.mid" type="hidden"
							value="${tag['mid'] }"></li>
						<li><input name="tag.type" type="hidden" value="tag"></li>
					</ul>
					<ul class="typecho-option typecho-option-submit"
						id="typecho-option-item--4">
						<li>
							<button type="submit" class="btn primary">增加标签</button>
						</li>
					</ul>
				</form>
			</div>
		</div>
	</div>
</div>
<jsp:include page="/admin/copyright.jsp"></jsp:include>
<jsp:include page="/admin/common-js.jsp"></jsp:include>
<script type="text/javascript">
	(function() {
		$(document).ready(function() {

			$('.typecho-list-notable').tableSelectable({
				checkEl : 'input[type=checkbox]',
				rowEl : 'li',
				selectAllEl : '.typecho-table-select-all',
				actionEl : '.dropdown-menu a'
			});

			$('.btn-drop').dropdownMenu({
				btnEl : '.dropdown-toggle',
				menuEl : '.dropdown-menu'
			});

			$('.dropdown-menu button.merge').click(function() {
				var btn = $(this);
				btn.parents('form').attr('action', btn.attr('rel')).submit();
			});

		});
	})();
</script>
<jsp:include page="/admin/footer.jsp"></jsp:include>
